#!/bin/bash

function list {
  case $1 in
    foxtel)
    >&2 echo "irsend: 0000000000000001 KEY_0"
    >&2 echo "irsend: 0000000000000002 KEY_1"
    >&2 echo "irsend: 0000000000000003 KEY_2"
    >&2 echo "irsend: 0000000000000004 KEY_3"
    >&2 echo "irsend: 0000000000000005 KEY_4"
    >&2 echo "irsend: 0000000000000006 KEY_5"
    >&2 echo "irsend: 0000000000000007 KEY_6"
    >&2 echo "irsend: 0000000000000008 KEY_7"
    >&2 echo "irsend: 0000000000000009 KEY_8"
    >&2 echo "irsend: 000000000000000a KEY_9"
    >&2 echo "irsend: 000000000000000b KEY_POWER"
    >&2 echo "irsend: 000000000000000c KEY_MUTE"
    >&2 echo "irsend: 000000000000000d KEY_INFO"
    >&2 echo "irsend: 000000000000000e KEY_VOLUMEUP"
    >&2 echo "irsend: 000000000000000f KEY_VOLUMEDOWN"
    >&2 echo "irsend: 0000000000000010 KEY_CHANNELUP"
    >&2 echo "irsend: 0000000000000011 KEY_CHANNELDOWN"
    >&2 echo "irsend: 0000000000000012 KEY_FASTFORWARD"
    >&2 echo "irsend: 0000000000000013 KEY_REWIND"
    >&2 echo "irsend: 0000000000000014 KEY_PLAY"
    >&2 echo "irsend: 0000000000000015 KEY_PAUSE"
    >&2 echo "irsend: 0000000000000016 KEY_STOP"
    >&2 echo "irsend: 0000000000000017 KEY_RECORD"
    >&2 echo "irsend: 0000000000000018 KEY_AV"
    >&2 echo "irsend: 0000000000000019 KEY_FOXTEL"
    >&2 echo "irsend: 000000000000001a KEY_SETUP"
    >&2 echo "irsend: 000000000000001b KEY_UP"
    >&2 echo "irsend: 000000000000001c KEY_DOWN"
    >&2 echo "irsend: 000000000000001d KEY_LEFT"
    >&2 echo "irsend: 000000000000001e KEY_RIGHT"
    >&2 echo "irsend: 000000000000001f KEY_SELECT"
    >&2 echo "irsend: 0000000000000020 KEY_RED"
    >&2 echo "irsend: 0000000000000021 KEY_GREEN"
    >&2 echo "irsend: 0000000000000022 KEY_YELLOW"
    >&2 echo "irsend: 0000000000000023 KEY_BLUE"
    >&2 echo "irsend: 0000000000000024 KEY_HELP"
    >&2 echo "irsend: 0000000000000025 KEY_BACK"
    >&2 echo "irsend: 0000000000000026 KEY_GUIDE"
    >&2 echo "irsend: 0000000000000027 KEY_BOXOFFICE"
    >&2 echo "irsend: 0000000000000028 KEY_PLANNER"
    >&2 echo "irsend: 0000000000000029 KEY_ACTIVE"
    ;;
  tv)
    >&2 echo "irsend: 00000000000040bf KEY_POWER"
    >&2 echo "irsend: 000000000000807f KEY_SOURCE"
    >&2 echo "irsend: 00000000000020df KEY_1"
    >&2 echo "irsend: 000000000000a05f KEY_2"
    >&2 echo "irsend: 000000000000609f KEY_3"
    >&2 echo "irsend: 00000000000010ef KEY_4"
    >&2 echo "irsend: 000000000000906f KEY_5"
    >&2 echo "irsend: 00000000000050af KEY_6"
    >&2 echo "irsend: 00000000000030cf KEY_7"
    >&2 echo "irsend: 000000000000b04f KEY_8"
    >&2 echo "irsend: 000000000000708f KEY_9"
    >&2 echo "irsend: 0000000000008877 KEY_0"
    >&2 echo "irsend: 00000000000034cb KEY_TTX"
    >&2 echo "irsend: 000000000000c837 KEY_PRE_CH"
    >&2 echo "irsend: 000000000000f00f KEY_MUTE"
    >&2 echo "irsend: 000000000000d629 KEY_CHANNEL_LIST"
    >&2 echo "irsend: 000000000000e01f KEY_VOLUMEUP"
    >&2 echo "irsend: 000000000000d02f KEY_VOLUMEDOWN"
    >&2 echo "irsend: 00000000000048b7 KEY_CHANNEL_UP"
    >&2 echo "irsend: 00000000000008f7 KEY_CHANNEL_DOWN"
    >&2 echo "irsend: 00000000000058a7 KEY_MENU"
    >&2 echo "irsend: 0000000000009e61 KEY_CONTENT"
    >&2 echo "irsend: 000000000000f20d KEY_GUIDE"
    >&2 echo "irsend: 000000000000d22d KEY_TOOLS"
    >&2 echo "irsend: 000000000000f807 KEY_INFO"
    >&2 echo "irsend: 00000000000006f9 KEY_UP"
    >&2 echo "irsend: 0000000000008679 KEY_DOWN"
    >&2 echo "irsend: 000000000000a659 KEY_LEFT"
    >&2 echo "irsend: 00000000000046b9 KEY_RIGHT"
    >&2 echo "irsend: 00000000000016e9 KEY_OK"
    >&2 echo "irsend: 0000000000001ae5 KEY_RETURN"
    >&2 echo "irsend: 000000000000b44b KEY_EXIT"
    >&2 echo "irsend: 00000000000036c9 KEY_A"
    >&2 echo "irsend: 00000000000028d7 KEY_B"
    >&2 echo "irsend: 000000000000a857 KEY_C"
    >&2 echo "irsend: 0000000000006897 KEY_D"
    >&2 echo "irsend: 000000000000c936 KEY_INTERNET"
    >&2 echo "irsend: 00000000000000ff KEY_DUAL"
    >&2 echo "irsend: 000000000000e41b KEY_AD"
    >&2 echo "irsend: 000000000000a45b KEY_SUBST"
    >&2 echo "irsend: 000000000000a25d KEY_REWIND"
    >&2 echo "irsend: 00000000000012ed KEY_FASTFORWARD"
    >&2 echo "irsend: 00000000000052ad KEY_PAUSE"
    >&2 echo "irsend: 000000000000926d KEY_REC"
    >&2 echo "irsend: 000000000000e21d KEY_PLAY"
    >&2 echo "irsend: 000000000000629d KEY_STOP"
    ;;
  receiver)
    >&2 echo "irsend: 000000005ea1b847 KEY_POWER"
    >&2 echo "irsend: 000000005ea17887 KEY_STANDBY"
    >&2 echo "irsend: 000000007e8154ab KEY_POWER_STANDBY"
    >&2 echo "irsend: 000000005ea10cf3 KEY_SLEEP"
    >&2 echo "irsend: 000000005ea1e21c KEY_HDMI1"
    >&2 echo "irsend: 000000005ea152ac KEY_HDMI2"
    >&2 echo "irsend: 000000005ea1b24c KEY_HDMI3"
    >&2 echo "irsend: 000000005ea10af4 KEY_HDMI4"
    >&2 echo "irsend: 000000005ea1ca34 KEY_AV1"
    >&2 echo "irsend: 000000005ea16a94 KEY_AV2"
    >&2 echo "irsend: 000000005ea19a64 KEY_AV3"
    >&2 echo "irsend: 000000005ea13ac4 KEY_AV4"
    >&2 echo "irsend: 000000005ea1fa04 KEY_AV5"
    >&2 echo "irsend: 000000005ea1a658 KEY_AUDIO1"
    >&2 echo "irsend: 000000005ea116e8 KEY_AUDIO2"
    >&2 echo "irsend: 000000005ea1aa55 KEY_VAUX"
    >&2 echo "irsend: 00000000fe8052ad KEY_DOCK"
    >&2 echo "irsend: 000000005ea16897 KEY_TUNER"
    >&2 echo "irsend: 000000005ea100fe KEY_DVD"
    >&2 echo "irsend: 000000005ea1c03e KEY_TV"
    >&2 echo "irsend: 000000005ea1609e KEY_CD"
    >&2 echo "irsend: 000000005ea1906e KEY_RADIO"
    >&2 echo "irsend: 000000005ea111ee KEY_MOVIE"
    >&2 echo "irsend: 000000005ea1916e KEY_MUSIC"
    >&2 echo "irsend: 000000005ea129d6 KEY_ENHANCER"
    >&2 echo "irsend: 000000005ea1b14e KEY_SURROUNDDECODE"
    >&2 echo "irsend: 000000005ea16a95 KEY_STRAIGHT"
    >&2 echo "irsend: 000000005ea158a7 KEY_VOLUMEUP"
    >&2 echo "irsend: 000000005ea1d827 KEY_VOLUMEDOWN"
    >&2 echo "irsend: 000000005ea138c7 KEY_MUTE"
    >&2 echo "irsend: 000000005ea1b946 KEY_UP"
    >&2 echo "irsend: 000000005ea1f906 KEY_LEFT"
    >&2 echo "irsend: 000000005ea17b84 KEY_ENTER"
    >&2 echo "irsend: 000000005ea17986 KEY_RIGHT"
    >&2 echo "irsend: 000000005ea139c6 KEY_DOWN"
    >&2 echo "irsend: 000000005ea155aa KEY_RETURN"
    >&2 echo "irsend: 00000000fe8006f9 KEY_DISPLAY"
    >&2 echo "irsend: 000000005ea121de KEY_SETUP"
    >&2 echo "irsend: 000000005ea1d628 KEY_OPTION"
    >&2 echo "irsend: 00000000fe801ae4 KEY_FM"
    >&2 echo "irsend: 00000000fe80aa54 KEY_AM"
    >&2 echo "irsend: 00000000fe80da24 KEY_PRESETUP"
    >&2 echo "irsend: 00000000fe808678 KEY_TUNINGUP"
    >&2 echo "irsend: 00000000fe807a84 KEY_PRESETDOWN"
    >&2 echo "irsend: 00000000fe8026d8 KEY_TUNINGDOWN"
    >&2 echo "irsend: 000000005ea1e41a KEY_INFO"
    >&2 echo "irsend: 00000000fe80e618 KEY_MEMORY"
    >&2 echo "irsend: 000000005ea1a758 KEY_1"
    >&2 echo "irsend: 000000005ea16798 KEY_2"
    >&2 echo "irsend: 000000005ea1e718 KEY_3"
    >&2 echo "irsend: 000000005ea117e8 KEY_4"
    >&2 echo "irsend: 000000005ea19768 KEY_5"
    >&2 echo "irsend: 000000005ea157a8 KEY_6"
    >&2 echo "irsend: 000000005ea1d728 KEY_7"
    >&2 echo "irsend: 000000005ea137c8 KEY_8"
    >&2 echo "irsend: 000000005ea18d72 KEY_9"
    >&2 echo "irsend: 000000005ea14db2 KEY_0"
    >&2 echo "irsend: 000000005ea1cd32 KEY_ENT"
    >&2 echo "irsend: 00000000fe80708f KEY_UP"
    >&2 echo "irsend: 00000000fe8008f7 KEY_LEFT"
    >&2 echo "irsend: 00000000fe808877 KEY_ENTER"
    >&2 echo "irsend: 00000000fe8048b7 KEY_RIGHT"
    >&2 echo "irsend: 00000000fe8028d7 KEY_DOWN"
    >&2 echo "irsend: 00000000fe80b847 KEY_STOP"
    >&2 echo "irsend: 00000000fe8058a7 KEY_PAUSE"
    >&2 echo "irsend: 00000000fe807887 KEY_PLAY"
    >&2 echo "irsend: 00000000fe80e817 KEY_REWIND"
    >&2 echo "irsend: 00000000fe8018e7 KEY_FASTFORWARD"
    >&2 echo "irsend: 00000000fe80d827 KEY_NEXT"
    >&2 echo "irsend: 00000000fe8038c7 KEY_PREVIOUS"
    >&2 echo "irsend: 00000000fe80a857 KEY_DISPLAY"
    ;;
  "")
    >&2 echo "irsend: foxtel"
    >&2 echo "irsend: tv"
    >&2 echo "irsend: receiver"
    ;;
  esac
}

case $1 in
  send_once)
    exit 0
    ;;
  send_start)
    exit 0
    ;;
  send_stop)
    exit 0
    ;;
  list)
    list $2
    ;;
esac
